Advanced Options#
import panel as pn
import waloviz as wv
wv.extension()
In WaloViz there are a few features which are situational and nuanced, these advanced options make WaloViz more than just simple, but powerful.
The following demonstrations are examples of advanced options and their effects in action, for the full list of options go to the Reference Manual.
Resampling#
To display an audio with a different sample-rate, just set the sr variable in addition to the source:
pn.Row(
wv.Audio("local_data/Yoshi.wav", minimal=True),
wv.Audio("local_data/Yoshi.wav", minimal=True, sr=8000),
)
<class 'bokeh.models.plots.GridPlot'>
<class 'bokeh.models.plots.GridPlot'>
Spectrogram Resolution#
To set the spectrogram to a different resolution in frequency or time, use the frame_ms and hop_ms variables:
pn.Row(
wv.Audio("local_data/Yoshi.wav", minimal=True, frame_ms=50, hop_ms=25),
wv.Audio("local_data/Yoshi.wav", minimal=True, frame_ms=0.5, hop_ms=0.25),
)
<class 'bokeh.models.plots.GridPlot'>
<class 'bokeh.models.plots.GridPlot'>
Colors#
To set the colormap use cmap, and set colorbar=True for a log scale color bar:
pn.Row(
wv.Audio("local_data/Yoshi.wav", minimal=True, cmap="viridis", colorbar=True),
wv.Audio("local_data/Yoshi.wav", minimal=True, cmap="jet", colorbar=True),
)
<class 'bokeh.models.plots.GridPlot'>
<class 'bokeh.models.plots.GridPlot'>
Theme#
You can set the bokeh theme with the theme option, a string will load one of the predefined themes of bokeh:
"dark_minimal""light_minimal""caliber""contrast""night_sky"
pn.Row(
wv.Audio("local_data/Yoshi.wav", minimal=True, theme="light_minimal"),
wv.Audio("local_data/Yoshi.wav", minimal=True, theme="night_sky"),
)
<class 'bokeh.models.plots.GridPlot'>
<class 'bokeh.models.plots.GridPlot'>
Download & Native Player#
You can use the download_button and native_player options to show or hide them:
pn.Row(
wv.Audio("local_data/Yoshi.wav"),
wv.Audio("local_data/Yoshi.wav", download_button=False, native_player=True),
)
<class 'bokeh.models.plots.GridPlot'>
<class 'bokeh.models.plots.GridPlot'>
Title#
Use the title to set an name for the player, it will be used when saving the plot to an HTML file, also you can embed the title with the player with the embed_title option:
pn.Row(
wv.Audio("local_data/Yoshi.wav"),
wv.Audio("local_data/Yoshi.wav", title="Big Yoshi", embed_title=True),
)
<class 'bokeh.models.plots.GridPlot'>
<class 'bokeh.models.plots.GridPlot'>